class CollidableSprite extends AnimSprite implements ICollidable{
  
  CollisionManager colManager;
  List<CollisionQuadrant> quadrants;
  List<String> collidableTypes;
  Point _topLeft;
  Point _botRight;
  
  CollidableSprite(Object animSpec):super(animSpec)
  {
    quadrants = new List<CollisionQuadrant>();
    colManager = new CollisionManager();
    collidableTypes = [];
    _topLeft = new Point(0,0);
    _botRight = new Point(0,0);
  }
  
  void addToQuadrant(CollisionQuadrant quadrant)
  {
    if(quadrants.indexOf(quadrant) == -1)
    {
      quadrants.add(quadrant);
    }
  }
  
  void removeFromQuadrant(CollisionQuadrant quadrant)
  {
    int index = quadrants.indexOf(quadrant);
    if(index != -1)
    {
      quadrants.removeRange(index, 1);
    }
  }
  
  void collisionDetected()
  {
  }
    
  Point get topLeft() 
  {
    _topLeft.x = getAbsX();
    _topLeft.y = getAbsY();
    
    return _topLeft;
  }
  
  Point get botRight() 
  {
    _botRight.x = topLeft.x + getWidth();
    _botRight.y = topLeft.y + getHeight();
    
    return _botRight;
  }
  
  num getWidth() 
  {
    return this.width;
  }
  
  num getHeight() 
  {
    return this.height;
  }
  
  void onPositionChange()
  {
    colManager.objectPositionChanged(this); 
    super.onPositionChange();
  }
  
  List<String> getCollidableTypes()
  {
    return collidableTypes;
  }
  
  String getType()
  {
    return "";
  }
  
  List<CollisionQuadrant> getQuadrants()
  {
    return this.quadrants;
  }
}
